package com.duolaibei.pay.activity;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.widget.ImageView;

import com.duolaibei.pay.R;
import com.duolaibei.pay.base.BaseActivity;
import com.duolaibei.pay.base.Constants;
import com.duolaibei.pay.utils.SharedPreferencesUtils;
import com.uuzuche.lib_zxing.activity.CodeUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by wangshuo on 2017/6/5.
 */

public class SweepGatheringActivity extends BaseActivity {
    @Bind(R.id.image)
    ImageView image;

    @Override
    public int getContentViewResId() {
        return R.layout.activity_sweep_gather;
    }

    @Override
    public void intiViews() {
        final String url = SharedPreferencesUtils.getOneSharedPreferences(this, Constants.SHOP_INFO_SP_NAME, Constants.URL);
        new Thread(new Runnable() {
            @Override
            public void run() {
                final Bitmap bitmap = CodeUtils.createImage(url,
                        getResources().getDimensionPixelSize(R.dimen.erweima_height),
                        getResources().getDimensionPixelSize(R.dimen.erweima_height), null);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        image.setImageBitmap(bitmap);
                    }
                });
            }
        }).start();
    }

    @Override
    public String setTitle() {
        return "扫码收款";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
    }
}
